package cn.yunyichina.provider.pay.executor;

import org.springframework.stereotype.Component;

import java.util.concurrent.*;

/**
 * 支付通知异步业务逻辑处理类
 * <p>
 * Created by Lullaby on 2017/7/20
 */
@Component
public class PayNotifyExecutor extends ThreadPoolExecutor {

    private static final int COREPOOLSIZE = 10;
    private static final int MAXIMUMPOOLSIZE = 30;
    private static final long KEEPALIVETIME = 100;

    private static final int WORKQUEUECAPACITY = 10;

    private static BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<>(WORKQUEUECAPACITY);

    private static PayNotifyThreadFactory threadFactory = new PayNotifyThreadFactory();

    public PayNotifyExecutor() {
        super(COREPOOLSIZE, MAXIMUMPOOLSIZE, KEEPALIVETIME, TimeUnit.SECONDS, workQueue, threadFactory);
    }

    public PayNotifyExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
    }

    public PayNotifyExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
    }

}
